/**
 * 将对象参数转换成字符串拼接在网址上
 * @param  {Object} param_obj {对象参数}
 * @return {string} {转换完成的字符串}
 */
export function paramJoin(param_obj) {
	if (!param_obj) return '';

	const filter_keys_arr = Object.keys(param_obj);

	return filter_keys_arr.reduce((before, current, index) => {
		let joint_symbol = filter_keys_arr.length - 1 - index ? '&' : '';

		if (param_obj[current]) {
			if (Object.prototype.toString.call(param_obj[current]) === '[object Array]') {
				let current_str = '';

				param_obj[current].forEach((obj) => {
                    
                    current_str += current + '[]=' + obj + '&'

                });
				return before + current_str + joint_symbol;
			}

			return `${before + current  }=${  param_obj[current]  }${joint_symbol}`;
		}
		return before;
	}, '?');
}
